home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / ViewIt™ 2.24 Shareware / FaceWare / FaceWare.rsrc / TEXT_1271_C3. Program Commands.txt < prev    next >
Text File  |  1994-04-10  |  10KB  |  67 lines

  1. C3. FaceIt Program Commands
  2.   FaceIt (and FaceSt) supports commands dealing with program initialization and management of events.
  3.   In addition to the commands presented below, standard label ID numbers can also be used as direct FaceIt commands if FaceIt (not FaceSt) is in use and the front window is not modal.  The following line, for example, would execute the standard "Copy" menu item:
  4.  FaceIt(nil,14,0,0,0,0);  {#14 = Copy}
  5.  
  6. Name  Number  Parameters & Variables used
  7. DoInit -61  a,b,c,d,uName,uResult
  8.  This command was first described in the "Initializations" topic in the "Startup" menu.  The additional information presented here supplements the original description and only applies if using FaceIt or FaceSt.
  9.   If using FaceIt or FaceSt (c ‚â• 0), then parameter a can be used to set various FaceIt or FaceSt options that affect program operation, and parameter c can be used to disable certain default operations performed by FaceIt or FaceSt when DoInit is called.
  10.  
  11.   a = sum of following constants (bit flags stored in fFlags):
  12.     1* = change cursor to deck of cards when returning control from DoLoop (can be helpful during development)
  13.     2 = return control to program whenever active window is changed (returns with uMenuID = 1100, uMenuItem = 2, uResult = 0)‚Ć
  14.     4 = return control to program whenever clipboard is changed (returns with uMenuID = 1100, uMenuItem = 4, uResult = 0)
  15.     8* = validate all non-ViewIt windows that require updating instead of hiding these windows (useful in some debugging environments that open status windows)
  16.     16* = disable all auto-saving on Quit or Transfer (no Save Document notices are posted to FCMD modules)
  17.     32* = hide all ViewIt windows when switching to background under MultiFinder or System ‚â• 7 (overrides "Hide on Switch" in Window dialog)‚Ć‚Ć
  18.     64 = don't show colors in ViewIt windows (overrides "Bits/Pixel Minimum" in Window dialog)
  19.     128 = disable all switching under System ‚â• 7 when a modal window is open or a window is in edit mode (overrides "Allow Modal Switch" option in Window dialog)
  20.     512* = return all Apple events that are not required events handled by FaceIt (returns uMenuID = 0 and the Apple event in fEvent), otherwise FaceIt processes such events along with the required events by calling "AEProcessAppleEvent"
  21.     1024* = return control to program before ExitToShell or transfer is executed by FaceIt (see discussion below)‚Ć‚Ć‚Ć
  22.  
  23.   b = kilobytes of extra stack space (see discussion of this parameter in "Initializations" in "Startup" topics)
  24.  
  25.   c = sum of following constants (bit flags):
  26.     1 = skip toolbox initializations (done in FaceProcXY)
  27.     2* = skip auto-initialization & insertion of main menus
  28.     4* = skip "About ProgramName" standard item setup
  29.     32* = do not auto-open any splash screen
  30.     64* = do not auto-open ViewIt Help window (this window) when ViewIt editing resources are available
  31.  
  32. where the constants that are followed by "*" correspond to functionality not supported by FaceSt, and "return control" in the context of FaceSt means that a pseudo-menu event is posted.
  33.   When returning from DoInit, some programs need to know whether the user is attempting to open or print one or more program data files "from the Finder" so that, if not, then they can open a default window.  If using FaceIt, this information is returned in uResult:  0 = no files, 1 = one or more files are being opened from the Finder.  If files are being opened from the Finder, then one message for each such file will be returned later from DoLoop (see description below).
  34. ‚Ć Closing a modal window can also result in this message being posted, so do not assume that this message is only posted when the active window changes.  If necessary, track the current program context in a program variable and only respond to this message if the new context truly differs from that saved by your program.
  35. ‚Ć‚Ć This bit option can be reset by the program at any time (using a call such as "BitSet(@fFlags,26)" or "BitClr(@fFlags,26)"), and could be used to provide a user with the option of hiding all windows when switching out.
  36. ‚Ć‚Ć‚Ć Adding 1024 to a causes FaceIt to return control to the program just before executing ExitToShell (if Quit chosen) or transferring to another program (if Transfer chosen).  The message returned has uMenuID = 1100, uMenuItem = 1024, uResult = 1 (Quit) or 2 (Transfer), and uName = name of program to transfer to.  Any subsequent call to FaceIt will then cause the program to immediately quit or transfer according to the contents of uName:  if uName is empty, then the program quits;  if uName is not empty, then the program transfers to the named application.  Warning: If you reset uName to transfer to a different application, be certain that the current directory contains that application.
  37.   Also note that adding 1024 does not replace the use of negative label numbers ("#-106") in menu items, since these can be used to get control before FaceIt goes through its Quit or Transfer- related operations (opening of the Transfer dialog, prompts to save changes, etc.), whereas bit value 1024 returns control after these operations are performed and the Quit or Transfer cannot be cancelled.
  38.  
  39. DoLoop  0  a
  40.   Used to enter FaceIt's main event loop which automatically handles most events.  Control remains with FaceIt's event loop until an event occurs that "belongs" to your program.  Info about such events is then returned in uMenuID, uMenuItem, uResult, uString, and other fRec variables.  One such event, for example, is the open/print a file "from the Finder" message described in the "Finder Resources" topic:
  41.   uMenuID = 1100
  42.   uMenuItem = 512
  43.   uResult = 1 (open) or 2 (print)
  44.   uString = file type
  45.   uName = file name
  46.   & current directory set that containing the file
  47. which is returned from DoLoop whenever the user attempts to open or print a file from the Finder.
  48.   OPTIONS:  Parameter a can optionally be used to have control returned to the program immediately after calling DoLoop.  If a = -1, then control is returned after updating all windows, the active window status, etc. (same as calling DoUpdt w/ d = -1).  If a = -2, then control is only returned after processing all pending events.  In this case, if no event is the cause of control being returned, then uMenuID and fEvent.what will be zero.  These options are similar to the options supported by parameter b when using MdlWnd to handle events in modal ViewIt windows.  (The "Background Processing" topic contains a further discussion of these options.)
  49.   PORT NOTE:  DoLoop always resets the current port to the active window unless the last event returned was a raw Apple event (the exception for Apple events was necessary to support interapplication communication via the ScriptIt module).
  50.   SLEEP NOTE:  While executing DoLoop, FaceIt "sleeps" for a period of time determined by the variable fFrontSleep when in the foreground and fBackSleep when in the background under MultiFinder or System 7.  This sleep time will affect any operation that relies on "idle" time to get things done.  This includes the use of parameter a = -2 to get control back from DoLoop, and ViewIt controls such as QuickControl which relies on the "hook" message when playing movies.  To give more time to such operations (at price of slowing background operations occurring in other programs), the default sleep times of 6 (front) and 8 (back) ticks can be made smaller.  To do this you need to reset both the current sleep time, fSleep, and one or both of the sleep parameters fFrontSleep and fBackSleep that are used to reset fSleep when switching occurs.  The QuickControl demo, for example, contains the following lines after DoInit:
  51.  fRec.fSleep := 0;
  52.  fRec.fFrontSleep := 0;
  53. which results in better performance when playing movies.  Be careful that the resulting fFrontSleep ‚↠fBackSleep since the foreground or background state of the program is tracked by comparing fSleep with these variables.
  54.   NOTE:  DoLoop is not supported by FaceSt, and should not be called when a modal window is open.
  55.  
  56. DoEvnt -51  fEvent
  57.   Asks FaceIt or FaceSt to handle the event passed in fEvent.  If using FaceIt, then DoEvnt is used to pass events to FaceIt that are encountered while programs are doing background processing (discussed in "Background Processing" topic in FaceIt guide).
  58.   If using FaceSt, then DoEvnt is used to pass FaceSt all ViewIt window-related events that are not handled by the main program (described in "Hybrid Programs" topic).
  59.   NOTE:  DoEvnt should not be called when a modal window is open.
  60.  
  61. DoMenu -52  a,b,uMenuID,uMenuItem
  62.   Forces FaceIt or FaceSt to handle the menu event passed in parameters a (menuID) and b (menu item number).  If a and b are zero, then FaceIt and FaceSt look in uMenuID and uMenuItem for the identity of the menu item to execute.  DoMenu is typically used with FaceSt to pass it selections from main program menus.  If the menu selection does not correspond to a standard menu item, then FaceSt reposts the menu event as a message returned by GetMsg.
  63.   NOTE:  DoMenu should not be called when a modal window is open.
  64.  
  65. GetMsg -55  [none]
  66.   FaceWare modules return special messages and events to the main program by placing them in a private queue with the utility command PstEvt (see "Other Utilities" topic for more info).  When using FaceIt, messages from the private queue are automatically processed and returned from DoLoop as menu or pseudo-menu events.  When using FaceSt, the main program must call GetMsg to get the next message in the queue if the queue is not empty (see "Hybrid Programs" topic for details).
  67.   NOTE:  GetMsg is not supported by FaceIt.